fix state management and other issues#1
Conversation
✅ Deploy Preview for incomparable-custard-29a20c ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
| {:else if activeResource.status === "loading"} | ||
| <p | ||
| class="rounded-md border bg-background/45 px-3 py-2 text-sm text-muted-foreground" | ||
| > | ||
| Loading {type} data... | ||
| </p> | ||
| {:else if activeResource.data.length === 0} | ||
| <p | ||
| class="rounded-md border bg-background/45 px-3 py-2 text-sm text-muted-foreground" | ||
| > | ||
| Enter a {type} ID to fetch charts and export CSVs. | ||
| </p> |
There was a problem hiding this comment.
I really do not like this. this section should just be removed if there's no error.
| {:else if activeResource.status === "loading"} | |
| <p | |
| class="rounded-md border bg-background/45 px-3 py-2 text-sm text-muted-foreground" | |
| > | |
| Loading {type} data... | |
| </p> | |
| {:else if activeResource.data.length === 0} | |
| <p | |
| class="rounded-md border bg-background/45 px-3 py-2 text-sm text-muted-foreground" | |
| > | |
| Enter a {type} ID to fetch charts and export CSVs. | |
| </p> |
| > | ||
| <Button | ||
| type="submit" | ||
| class="w-full lg:w-28" |
There was a problem hiding this comment.
this button is way too wide now
| class="w-full lg:w-28" | |
| class="w-full lg:w-24" |
| autocomplete="off" | ||
| spellcheck="false" | ||
| placeholder={type === "channel" | ||
| ? "UC_x5XG1OV2P6uZZ5FSM9Ttw" |
There was a problem hiding this comment.
why are we doing Google for Developers for this??
| ? "UC_x5XG1OV2P6uZZ5FSM9Ttw" | |
| ? "UCX6OQ3DkcsbYNE6H8uQQuVA" |
| <header class="flex flex-col gap-1"> | ||
| <h1 | ||
| class="text-2xl font-semibold tracking-normal text-foreground sm:text-3xl" | ||
| > | ||
| SCTools Data Exporter | ||
| </h1> | ||
| </header> |
There was a problem hiding this comment.
there's a reason why I didn't add a header to the website: it is cheesy af
| $effect(() => { | ||
| if (source !== lastSource) { | ||
| lastSource = source; | ||
| resetAllLoadedData(); | ||
| syncUrlToActiveType(type); |
There was a problem hiding this comment.
again, this is why I used useSearchParams. this is just dealt with.
| >([]); | ||
| let lastSource = $state.raw<Source>("vidiq"); | ||
| let lastType = $state.raw<ResourceType>("channel"); | ||
| const requestControllers: Partial<Record<ResourceType, AbortController>> = {}; |
There was a problem hiding this comment.
this should probably be a $state
| const requestControllers: Partial<Record<ResourceType, AbortController>> = {}; | |
| const requestControllers = $state<Partial<Record<ResourceType, AbortController>>>({}); |
| <Label for="resource-id">{capitalize(type)} ID</Label> | ||
| <Input | ||
| id="resource-id" | ||
| bind:value={resources[type].draftId} |
There was a problem hiding this comment.
this is an unnecessary lookup for the resource. we already have a $derived variable for this
| bind:value={resources[type].draftId} | |
| bind:value={activeResource.draftId} |
|
|
||
| <svelte:head><link rel="icon" href={favicon} /></svelte:head> | ||
| <main class="p-6"> | ||
| <main class="min-h-dvh px-3 py-4 sm:px-6 sm:py-6"> |
There was a problem hiding this comment.
I don't think the padding needs to change when on different screen sizes
| let lastSource = $state.raw<Source>("vidiq"); | ||
| let lastType = $state.raw<ResourceType>("channel"); |
There was a problem hiding this comment.
why is type first before source on the current values, but source comes before type in the last values??
| let lastSource = $state.raw<Source>("vidiq"); | |
| let lastType = $state.raw<ResourceType>("channel"); | |
| let lastType = $state.raw<ResourceType>("channel"); | |
| let lastSource = $state.raw<Source>("vidiq"); |
| import { env } from "$env/dynamic/public"; | ||
| import { onMount } from "svelte"; | ||
| import { z } from "zod"; | ||
| import { useSearchParams } from "runed/kit"; |
There was a problem hiding this comment.
this should not have been removed. I specifically chose to use this library because it lets us keep the url as the source of truth
|
either way, I'm closing this pr. I don't want this project/repo to have commits associated with you. please never contact me, gnz, anyone else at sctools, or the stats community ever again |
fixes
i wanted to use the tool, but got tired of all the dumb issues and bugs, so i fixed it